Skip to content

Add InSampleUniformGenerator for model-free in-sample candidate selection#4987

Closed
ItsMrLin wants to merge 2 commits into
facebook:mainfrom
ItsMrLin:export-D94973263
Closed

Add InSampleUniformGenerator for model-free in-sample candidate selection#4987
ItsMrLin wants to merge 2 commits into
facebook:mainfrom
ItsMrLin:export-D94973263

Conversation

@ItsMrLin
Copy link
Copy Markdown
Contributor

@ItsMrLin ItsMrLin commented Mar 6, 2026

Summary:
Add InSampleUniformGenerator, a RandomGenerator subclass that randomly
selects n arms (without replacement) from existing experiment arms. This
replaces the previous in_sample mode on RandomAdapter (which bypassed the
generator entirely) with a proper generator class, following bletham's review
feedback on the original diff.

The generator overrides gen() to select from the generated_points array
that the adapter already constructs from in-design, non-failed experiment arms
(filtered, transformed, and deduplicated). This reuses existing infrastructure
without adding new interface surface.

Registered as Generators.IN_SAMPLE_UNIFORM in the adapter registry with
RandomAdapter and Cont_X_trans, matching the pattern of other random
generators (Sobol, Uniform).

The resulting user-facing matrix is clean:

Out-of-sample In-sample
Model-free Generators.SOBOL Generators.IN_SAMPLE_UNIFORM
Model-based Generators.BOTORCH_MODULAR Generators.BOTORCH_MODULAR + model_gen_options={"in_sample": True}

The asymmetry (enum swap for model-free, flag for model-based) reflects the
real architectural difference: model-based in/out-of-sample share a fitted
model; model-free in/out-of-sample share nothing.

Reviewed By: bletham, saitcakmak

Differential Revision: D94973263

ItsMrLin added 2 commits March 5, 2026 22:58
…rials (facebook#4986)

Summary:

Add `Keys.LILO_LABELING` to identify LILO (Language-in-the-Loop) labeling trials
in generation strategies. LILO trials collect pairwise preference labels via LLM
calls and need a distinct trial type so they can be selectively marked STALE before
relabeling rounds.

- Add `LILO_LABELING = "lilo_labeling"` to `Keys` enum
- Extend `GenerationNode.__init__` trial type validation to accept `LILO_LABELING`
- Extend `Experiment.supports_trial_type()` to accept `LILO_LABELING`

Reviewed By: saitcakmak

Differential Revision: D94743845
…tion

Summary:
Add `InSampleUniformGenerator`, a `RandomGenerator` subclass that randomly
selects `n` arms (without replacement) from existing experiment arms. This
replaces the previous `in_sample` mode on `RandomAdapter` (which bypassed the
generator entirely) with a proper generator class, following bletham's review
feedback on the original diff.

The generator overrides `gen()` to select from the `generated_points` array
that the adapter already constructs from in-design, non-failed experiment arms
(filtered, transformed, and deduplicated). This reuses existing infrastructure
without adding new interface surface.

Registered as `Generators.IN_SAMPLE_UNIFORM` in the adapter registry with
`RandomAdapter` and `Cont_X_trans`, matching the pattern of other random
generators (Sobol, Uniform).

The resulting user-facing matrix is clean:

| | Out-of-sample | In-sample |
|---|---|---|
| **Model-free** | `Generators.SOBOL` | `Generators.IN_SAMPLE_UNIFORM` |
| **Model-based** | `Generators.BOTORCH_MODULAR` | `Generators.BOTORCH_MODULAR` + `model_gen_options={"in_sample": True}` |

The asymmetry (enum swap for model-free, flag for model-based) reflects the
real architectural difference: model-based in/out-of-sample share a fitted
model; model-free in/out-of-sample share nothing.

Reviewed By: bletham, saitcakmak

Differential Revision: D94973263
@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Mar 6, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 6, 2026

@ItsMrLin has exported this pull request. If you are a Meta employee, you can view the originating Diff in D94973263.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.83%. Comparing base (9f50a93) to head (8767da7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4987   +/-   ##
=======================================
  Coverage   96.83%   96.83%           
=======================================
  Files         599      601    +2     
  Lines       64584    64662   +78     
=======================================
+ Hits        62540    62616   +76     
- Misses       2044     2046    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 6, 2026

This pull request has been merged in a89122d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants